﻿using System;
using System.Collections.Generic;

using System.Web;
using System.Web.UI;
using System.Web.UI.WebControls;
using System.Drawing;
using System.Drawing.Imaging;

namespace ProjectQuaDep.Services
{
    public partial class LoadAvatar : System.Web.UI.Page
    {
        protected string img = "";
        protected void Page_Load(object sender, EventArgs e)
        {
            //
            string stringMasterImageName = @"D:\MasterImage.jpg";
            Bitmap bitmapMasterImage = new System.Drawing.Bitmap(stringMasterImageName);
            Graphics graphicsMasterImage = Graphics.FromImage(bitmapMasterImage);

            //Set the alignment based on the coordinates 
            StringFormat stringformatWriteTextFormat = new StringFormat();
            stringformatWriteTextFormat.Alignment = StringAlignment.Center;

            //Set the font color
            Color colorStringColor = System.Drawing.ColorTranslator.FromHtml("#000081");
            string stringText = "IMMUZIC";
            graphicsMasterImage.DrawString(stringText, new Font("Tahoma", 12,
            FontStyle.Bold), new SolidBrush(colorStringColor),
            new Point(50, 10), stringformatWriteTextFormat);
            Response.ContentType = "image/jpeg";
            bitmapMasterImage.Save(Response.OutputStream, ImageFormat.Jpeg);
            //Save the new image in a physical location
            string stringOutPutFileName = @"D:\\OutPut.jpg";
            bitmapMasterImage.Save(stringOutPutFileName);
            bitmapMasterImage.Dispose();
        }
    }
}